var pageObj = { currentPage: 1, pageSize: 10 };
export default {
  getExper() {
    let searchItem = [
      {
        label: "实验名称",
        prop: "expName",
        input: true,
      },
      {
        label: "实验类型",
        prop: "expGroup",
        tag: true,
        list: []
      },
      {
        label: "创建时间",
        prop: "time",
        timeSelect: true,
        type: 'datetimerange',
      },
    ];
    let buttonAll = {
      searchList: [
        {
          type: "search",
          text: "查询",
          icon: "el-icon-search",
          alwaysShow: true,
          types: "primary",
        },
        {
          type: "clear",
          text: "重置",
          icon: "el-icon-delete",
          alwaysShow: true,
        },
      ],
    };
    let searchObj = {};
    searchItem.map((it) => {
      it.width = '100px'
      searchObj[it.prop] = "";
    });
    let titleList = [
      {
        label: '序号',
        prop: 'index',
        slot: true
      },
      {
        label: "数据名称",
        prop: "name",
        width: 120,
      },
      {
        label: "每套拓扑图中使用的数量",
        prop: "expGroup",
        width: 200,
      },
      {
        label: "总数量",
        prop: "count",
        width: 120,
      },
      {
        label: "操作",
        prop: "operate",
        slot: true
      },
    ];
    let resultItem = [
      {
        label: "名称",
        prop: "result",
        input: true,
      },
      {
        label: "成果类型",
        prop: "resultType",
        tag: true,
        list: [{ label: '模型', id: 1 },
        { label: '算法', id: 2 },]
      },
      {
        label: "权限",
        prop: "jurisdiction",
        tag: true,
        list: [{ label: '公开', id: 1 }, { label: '私有', id: 2 }],
      },
      {
        label: "实验描述",
        prop: "remark",
        inputMore: true
      },
      {
        label: "成果附件",
        prop: "resultFile",
        nameProp: "fileName",
        upload: true
      }, 
    ];
    let resultObj = {}
    resultItem.map((it) => {
      it.width = '100px'
      resultObj[it.prop] = "";
    });
    let searchData = { ...searchObj, ...pageObj, state: '' };
    let resultData = resultObj
    return {
      searchItem,
      searchData,
      buttonAll,
      titleList,
      resultItem,
      resultData
    };
  },
  getFirstForm() {
    let searchItem = [
      {
        label: "实验名称",
        prop: "expName",
        input: true,
      },
      {
        label: "实验类型",
        prop: "expGroup",
        tag: true,
        list: [],
      },
      {
        label: "实验期限",
        prop: "time",
        timeSelect: true,
        type: 'datetimerange',
      },
      {
        label: "申请拓扑资源套数",
        prop: "tpCount",
        inputNum: true,
      },
      {
        label: "结果提交方式",
        prop: "resSubway",
        tag: true,
        list: [],
      },
      {
        label: "实验描述",
        prop: "remark",
        inputMore: true,
      },
    ];
    let searchData = {};
    searchItem.map((it) => {
      searchData[it.prop] = "";
    });
    return {
      searchItem,
      searchData
    };
  },
  getResource() {
    let searchItem = [
      {
        label: "名称",
        prop: "name",
        input: true,
      },
      {
        label: "类型",
        prop: "type",
        tag: true,
        list: [],
      },
      {
        label: "属性",
        prop: "attribute",
        tag: true,
        list: [{
          label: '可复制',
          id: '1'
        },{
          label: '不可复制',
          id: '2'
        }],
      },
      {
        label: "创建时间",
        prop: "createTime",
        timeSelect: true,
        type: 'datetime',
      },
      {
        label: "关键字",
        prop: "remark",
        input: true,
      },
    ];
    let buttonAll = {
      searchList: [
        {
          type: "search",
          text: "查询",
          icon: "el-icon-search",
          alwaysShow: true,
          types: "primary",
        },
        {
          type: "clear",
          text: "重置",
          icon: "el-icon-delete",
          alwaysShow: true,
        },
      ],
    };
    let titleList = [
      {
        label: '序号',
        prop: 'index',
        slot: true
      },
      {
        label: "数据名称",
        prop: "name",
        width: 120,
      },
      {
        label: "数据类型",
        prop: "type",
        width: 120,
      },
      {
        label: "描述",
        prop: "remark",
        width: 120,
      },
      {
        label: "属性",
        prop: "attribute",
        width: 120,
        getData: row => {
          if (row.attribute) {
            if (row.attribute === '1') {
              return '可复制'
            } else if (row.attribute === '2') {
              return '不可复制'
            }
          }
        },
      },
      {
        label: "余量/总量",
        prop: "total",
        width: 120,
        getData: row => {
          if (row.unusedCount && row.totalCount) {
            return row.unusedCount + "/" + row.totalCount;
          }
        },
      },
      {
        label: "阈值",
        prop: "thresholdValue",
        width: 120,
      },
      {
        label: "创建时间",
        prop: "createTime",
      },
      {
        label: "操作",
        prop: "count",
        slot: true
      },
    ];
    let tableData = [];
    let moduleTitleList = [
      {
        label: '序号',
        prop: 'index',
        slot: true
      },
      {
        label: "模型名称",
        prop: "name",
        width: 120,
      },
      {
        label: "模型类型",
        prop: "type",
        width: 120,
      },
      {
        label: "规格",
        prop: "specification",
        width: 120,
      },
      {
        label: "余量/总量",
        prop: "total",
        slot: true,
        width: 120,
        getData: row => {
          if (row.unusedCount && row.totalCount) {
            return row.unusedCount + "/" + row.totalCount;
          }
        },
      },
      {
        label: "创建时间",
        prop: "createTime",
      },
      {
        label: "操作",
        prop: "count",
        slot: true
      },
    ];
    let hardTitleList = [
      {
        label: '序号',
        prop: 'index',
        slot: true
      },
      {
        label: "硬件名称",
        prop: "name",
        width: 120,
      },
      {
        label: "硬件资源",
        prop: "hardwareType",
        width: 120,
      },
      {
        label: "规格",
        prop: "specification",
        width: 120,
      },
      {
        label: "余量/总量",
        prop: "total",
        width: 120,
        slot: true,
        getData: row => {
          if (row.unusedCount && row.totalCount) {
            return row.unusedCount + "/" + row.totalCount;
          }
        },
      },
      {
        label: "创建时间",
        prop: "createTime",
      },
      {
        label: "操作",
        prop: "count",
        slot: true
      },
    ];
    let choseTitleList = [
      {
        label: '序号',
        prop: 'index',
        slot: true
      },
      {
        label: "名称",
        prop: "name",
        width: 120,
      },
      {
        label: "每套拓扑图中使用的数量",
        prop: "count",
        width: 200,
      },
      {
        label: "总数量",
        prop: "totalCount",
        width: 120,
      },
    ];
    let searchObj = {};
    searchItem.map((it) => {
      it.width = it.label.length == 2 ? '60px' : '100px'
      searchObj[it.prop] = "";
    });
    let searchData = { ...searchObj, size:10,current:1 };
    return {
      searchItem,
      searchData,
      buttonAll,
      titleList,
      tableData,
      moduleTitleList,
      hardTitleList,
      choseTitleList,
    };
  },
  getExperAudit() {
    let searchItem = [
      {
        label: "实验名称",
        prop: "name",
        input: true,
      },
      {
        label: "实验类型",
        prop: "type",
        tag: true,
        list: [],
      },
      {
        label: "状态",
        prop: "attribute",
        tag: true,
        list: [],
      },
      {
        label: "申请人",
        prop: "remark",
        input: true,
      },
    ];
    let buttonAll = {
      searchList: [
        {
          type: "search",
          text: "查询",
          icon: "el-icon-search",
          alwaysShow: true,
          types: "primary",
        },
        {
          type: "clear",
          text: "重置",
          icon: "el-icon-delete",
          alwaysShow: true,
        },
        {
          type: "clear",
          text: "批量通过",
          icon: "el-icon-delete",
          alwaysShow: true,
          types: "primary",
        },
        {
          type: "clear",
          text: "批量驳回",
          icon: "el-icon-delete",
          alwaysShow: true,
          types: "danger",
        },
      ],
    };
    let titleList = [
      {
        label: '序号',
        prop: 'index',
        slot: true
      },
      {
        label: "实验名称",
        prop: "expName",
        width: 120,
      },
      {
        label: "实验类型",
        prop: "expGroup",
        width: 120,
      },
      {
        label: "实验期限",
        prop: "range",
        width: 300,
        getData: row => {
          if (row.startTime && row.endTime) {
            return row.startTime + "至" + row.endTime;
          }
        },
      },
      {
        label: "申请人",
        prop: "person",
        width: 120,
        sort: true,
      },
      {
        label: "状态",
        prop: "state",
        width: 120,
        sort: true,
      },
      {
        label: "操作",
        prop: "operate",
        slot: true
      },
    ];
    let tableData = [];
    let searchObj = {};
    searchItem.map((it) => {
      it.width = it.label.length == 2 ? '60px' : '100px'
      searchObj[it.prop] = "";
    });
    let searchData = { ...searchObj, ...pageObj };
    return {
      searchItem,
      searchData,
      buttonAll,
      titleList,
      tableData,
    };
  },
};
